home *** CD-ROM | disk | FTP | other *** search
- Path: news.production.compuserve.com!news
- From: Tom Wright <70215.1323@CompuServe.COM>
- Newsgroups: comp.lang.c
- Subject: Processing \n while reading char
- Date: 12 Mar 1996 13:58:44 GMT
- Organization: no organization
- Message-ID: <4i3vuk$ak$1@mhafc.production.compuserve.com>
-
- I've got a small program that reads a person's initials, followed
- by reading his/her test score. I used
-
- for (blah, blah)
- {
- printf (blah)
- scanf ("%c%c%c%*c", &c_1st, &c_mid, &c_last);
- printf (blah)
- scanf("%d%*c", &i_test_score):
- }
-
- I find the %*c to process the newline character to be somewhat
- clumsy. Is there a cleaner way to process/eliminate the
- newline character.
-
- One constriant of the program is that it must read the initials
- as character data; for this exercise, I cannot use strings.
-
- Any insight would be appreciated.
-
- Tom
-
- --
- Happy to be a soccer fan!!!
-